package com.xbell.dahua.demo.camera.dahua;

import com.netsdk.lib.NetSDKLib;
import com.sun.jna.Pointer;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;

/**
 * 人数统计回调
 */
@Slf4j
public class VideoStatSumCallback implements NetSDKLib.fVideoStatSumCallBack {

    @Getter
    private static final VideoStatSumCallback instance = new VideoStatSumCallback();

    private VideoStatSumCallback() {
    }

    public void invoke(NetSDKLib.LLong lAttachHandle, NetSDKLib.NET_VIDEOSTAT_SUMMARY stVideoState, int
            dwBufLen, Pointer dwUser) {
        log.info("Channel: {} GetTime: {} RuleName: {} People In Information[Total:{} Hour:{} Today:{}] People Out Information[Total[{}] Hour[{}] Today[{}]]",
                stVideoState.nChannelID, stVideoState.stuTime.toStringTime(),
                new String(stVideoState.szRuleName).trim(),
                stVideoState.stuEnteredSubtotal.nToday,
                stVideoState.stuEnteredSubtotal.nHour,
                stVideoState.stuEnteredSubtotal.nTotal,
                stVideoState.stuExitedSubtotal.nToday,
                stVideoState.stuExitedSubtotal.nHour,
                stVideoState.stuExitedSubtotal.nTotal
        );
        int mi = stVideoState.nInsidePeopleNum;
        log.info("人数: {}", mi);
    }

}